package com.kashow.bean;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Created by yybs on 16/9/9.
 */

public class PlayUrl implements Parcelable {

    /**
     * success : true
     * videoUrl : {"v2Kp":"/vr/test_1_2880x1440.mp4","v960p":"/vr/test_1_1920x960.mp4","v720p":"/vr/test_1_1440x720.mp4|/vr/test_1_audio.mp3","v480p":"/vr/test_1_960x480.mp4|/vr/test_1_audio.mp3","vPoster":"/vr/test_1_custom_preview.jpg"}
     * needReadLong : 10
     */

    private boolean success;
    /**
     * v2Kp : /vr/test_1_2880x1440.mp4
     * v960p : /vr/test_1_1920x960.mp4
     * v720p : /vr/test_1_1440x720.mp4|/vr/test_1_audio.mp3
     * v480p : /vr/test_1_960x480.mp4|/vr/test_1_audio.mp3
     * vPoster : /vr/test_1_custom_preview.jpg
     */


    public PlayUrl(String url) {
        this.videoUrl = new VideoUrl(url);
    }


    private VideoUrl videoUrl;
    private int needReadLong;
    private String msg;
    private int itemId;
    private int lessonNo;
    private String openid;

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public VideoUrl getVideoUrl() {
        return videoUrl;
    }

    public void setVideoUrl(VideoUrl videoUrl) {
        this.videoUrl = videoUrl;
    }

    public int getNeedReadLong() {
        return needReadLong;
    }

    public void setNeedReadLong(int needReadLong) {
        this.needReadLong = needReadLong;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public int getItemId() {
        return itemId;
    }

    public void setItemId(int itemId) {
        this.itemId = itemId;
    }

    public int getLessonNo() {
        return lessonNo;
    }

    public void setLessonNo(int lessonNo) {
        this.lessonNo = lessonNo;
    }

    public String getOpenid() {
        return openid;
    }

    public void setOpenid(String openid) {
        this.openid = openid;
    }

    public static class VideoUrl implements Parcelable {
        private String v2Kp;
        private String v960p;
        private String v720p;
        private String v480p;
        private String vPoster;

        public VideoUrl(String url) {
            this.v2Kp = url;
            this.v960p = url;
            this.v720p = url;
            this.v480p = url;
        }

        public String getV2Kp() {
            return v2Kp;
        }

        public void setV2Kp(String v2Kp) {
            this.v2Kp = v2Kp;
        }

        public String getV960p() {
            return v960p;
        }

        public void setV960p(String v960p) {
            this.v960p = v960p;
        }

        public String getV720p() {
            return v720p;
        }

        public void setV720p(String v720p) {
            this.v720p = v720p;
        }

        public String getV480p() {
            return v480p;
        }

        public void setV480p(String v480p) {
            this.v480p = v480p;
        }

        public String getVPoster() {
            return vPoster;
        }

        public void setVPoster(String vPoster) {
            this.vPoster = vPoster;
        }

        @Override
        public String toString() {
            return "VideoUrl{" +
                    "v2Kp='" + v2Kp + '\'' +
                    ", v960p='" + v960p + '\'' +
                    ", v720p='" + v720p + '\'' +
                    ", v480p='" + v480p + '\'' +
                    ", vPoster='" + vPoster + '\'' +
                    '}';
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(this.v2Kp);
            dest.writeString(this.v960p);
            dest.writeString(this.v720p);
            dest.writeString(this.v480p);
            dest.writeString(this.vPoster);
        }

        public VideoUrl() {
        }

        protected VideoUrl(Parcel in) {
            this.v2Kp = in.readString();
            this.v960p = in.readString();
            this.v720p = in.readString();
            this.v480p = in.readString();
            this.vPoster = in.readString();
        }

        public static final Creator<VideoUrl> CREATOR = new Creator<VideoUrl>() {
            @Override
            public VideoUrl createFromParcel(Parcel source) {
                return new VideoUrl(source);
            }

            @Override
            public VideoUrl[] newArray(int size) {
                return new VideoUrl[size];
            }
        };
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeByte(this.success ? (byte) 1 : (byte) 0);
        dest.writeParcelable(this.videoUrl, flags);
        dest.writeInt(this.needReadLong);
        dest.writeString(this.msg);
        dest.writeInt(this.itemId);
        dest.writeInt(this.lessonNo);
        dest.writeString(this.openid);
    }

    public PlayUrl() {
    }

    protected PlayUrl(Parcel in) {
        this.success = in.readByte() != 0;
        this.videoUrl = in.readParcelable(VideoUrl.class.getClassLoader());
        this.needReadLong = in.readInt();
        this.msg = in.readString();
        this.itemId = in.readInt();
        this.lessonNo = in.readInt();
        this.openid = in.readString();
    }

    public static final Creator<PlayUrl> CREATOR = new Creator<PlayUrl>() {
        @Override
        public PlayUrl createFromParcel(Parcel source) {
            return new PlayUrl(source);
        }

        @Override
        public PlayUrl[] newArray(int size) {
            return new PlayUrl[size];
        }
    };
}
